package com.rent.web.gateway.controller;

import com.rent.web.gateway.config.MySwaggerResourceProvider;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger.web.SwaggerResource;

import java.util.List;

/**
 * @Author zhang
 * @create 2022/4/15 11:25
 */
@Slf4j
@RestController
@RequestMapping("/swagger-resources")
@RequiredArgsConstructor
public class SwaggerResourceController {

    private final MySwaggerResourceProvider swaggerResourceProvider;

    @RequestMapping
    public ResponseEntity<List<SwaggerResource>> swaggerResources() {
        log.info("访问接口文档");
        return new ResponseEntity<>(swaggerResourceProvider.get(), HttpStatus.OK);
    }

}
